//////////////////////////////////////////////////////////////////////////
//
// This file is a part of APNS provider project.
// Copyright (c) Vladimir Gumenuk, 2013-2014.
//
// PROJECT:         APNS provider
// FILE:            GMSBuffer.h: interface of the CGMSBuffer class.
// AUTHOR:          Vladimir Gumenuk
// DATE:            22-Dec-2013
// MODIFICATIONS:
//
//////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GMSBUFFER_H__FA1F9303_4A8C_4B6A_BB89_D09621A849BA__INCLUDED_)
#define AFX_GMSBUFFER_H__FA1F9303_4A8C_4B6A_BB89_D09621A849BA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class ATL_NO_VTABLE CGMSBuffer :
    public CComObjectRootEx<CComMultiThreadModel>,
    public IGMSBuffer
{
public:
	CGMSBuffer();
	virtual ~CGMSBuffer();

    static HRESULT Create( IGMSBuffer **ppOut );

BEGIN_COM_MAP(CGMSBuffer)
	COM_INTERFACE_ENTRY_IID(IID_IGMSBuffer,IGMSBuffer)
END_COM_MAP()

    STDMETHOD_(DWORD,GetSize)();
    STDMETHOD_(const LPBYTE, GetPtr)();
    STDMETHOD(Add)( const LPBYTE pBuf, DWORD dwSize );
    STDMETHOD(AddBYTE)( BYTE Val );
    STDMETHOD(Attach)( LPBYTE pBuf, DWORD dwSize );

private:
    typedef CSimpleArray<BYTE> MEMORYBLOCK;
    MEMORYBLOCK    m_Buffer;
    
};

typedef CComObject<CGMSBuffer> TGMSBufferImpl;

#endif // !defined(AFX_GMSBUFFER_H__FA1F9303_4A8C_4B6A_BB89_D09621A849BA__INCLUDED_)
